package yawning.mew.bear;

import yawning.mew.sim.SimulationEvent;

public class InfectedWoundsEvent extends SimulationEvent {
	BearThreatSimulator mState;
	private boolean mHasInfectedWounds;

	InfectedWoundsEvent(BearThreatSimulator state) {
		super(state.mSimEngine);
		mState = state;

		mHasInfectedWounds = mState.mModel.mToon.getTalent(BearModel.INFECTEDWOUNDS) > 0;
	}

	void onTrigger() {
		if (mHasInfectedWounds) {
			mNrInfectedWoundsProcs++;
			if (!isUp()) {
				mState.mActiveTarget.getTargetSwingEv().multiplyAttackSpeed(mState.mModel.multInfectedWounds);
				if (mState.mIsLogging) mState.mLog.log("Infected Wounds\n");
			} else {
				if (mState.mIsLogging) mState.mLog.log("Infected Wounds Refresh\n");
			}
			schedule(mState.mModel.infectedWoundsDebuffDuration);
		}
	}

	@Override
	public void onExpire() {
		mState.mActiveTarget.getTargetSwingEv().multiplyAttackSpeed(1.0 / mState.mModel.multInfectedWounds);

		if (mState.mIsLogging) mState.mLog.log("Infected Wounds Expiration\n");
	}

	int mNrInfectedWoundsProcs;
}
